import axios from 'axios';

// 创建一个Axios实例，设置基础URL
const api = axios.create({
  baseURL: typeof window !== 'undefined' 
    ? `${window.location.protocol}//${window.location.hostname}:3000` 
    : 'http://localhost:3000',
  timeout: 10000,
  headers: {
    'Content-Type': 'application/json',
  },
});

export default api; 